home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.4)
-
- print '3. Operations'
- print 'XXX Mostly not yet implemented'
- print '3.1 Dictionary lookups succeed even if __cmp__() raises an exception'
-
- class BadDictKey:
- already_printed_raising_error = 0
-
- def __hash__(self):
- return hash(self.__class__)
-
-
- def __cmp__(self, other):
- if isinstance(other, self.__class__):
- if not BadDictKey.already_printed_raising_error:
- BadDictKey.already_printed_raising_error = 1
- print 'raising error'
-
- raise RuntimeError, 'gotcha'
-
- return other
-
-
- d = { }
- x1 = BadDictKey()
- x2 = BadDictKey()
- d[x1] = 1
- d[x2] = 2
- print 'No exception passed through.'
- d = { }
- for i in range(5):
- d[i] = i
-
- for i in range(5):
- del d[i]
-
- for i in range(5, 9):
- d[i] = i
-
-